package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.IUserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {
    @Resource
    private IUserService IUserService;

    @RequestMapping("/get/{id}")
    public User queryById(@PathVariable("id") int id) {
        return IUserService.getById(id);
    }

    @RequestMapping("/save")
    public void addDept(User user) {
        IUserService.save(user);
    }
}
